<%@ page import="com.hdu.heihei.service.impl.UserServiceImpl" %>
<%@ page import="com.hdu.heihei.beans.User" %>
<%@ page import="com.hdu.heihei.service.impl.UserServiceImpl" %>
<%--
  Created by IntelliJ IDEA.
  User: fengyuan
  Date: 2020/9/29
  Time: 01:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>注销</title>
</head>
<body>
<%
    UserServiceImpl userServiceImpl = new UserServiceImpl();

    int userId = 0;
    Cookie[] cookies = request.getCookies();
    for (Cookie cookie : cookies){
        if(cookie.getName().equals("userId")) {
            userId = Integer.parseInt(cookie.getValue());
        }
        break;
    }

    System.out.println(userId);
    if(userServiceImpl.cancellationById(userId)){
        out.print("<script language='javaScript'> alert('注销账户成功');</script>");
        response.setHeader("refresh", "0;url=../login.html");
    }

%>
</body>
</html>
